package com.kunbo.cn.app.controller;

import java.util.List;
import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.kunbo.cn.service.core.purchase.WaybillService;
import com.kunbo.cn.util.retu.BuildBean;
import com.kunbo.cn.util.retu.ResultBean;

@RestController
@RequestMapping("/wayBill")
public class WayBillController {

	@Autowired
	private WaybillService waybillService;

	// 获取所有运单
	@PostMapping("/getWayBillOrder")
	public ResultBean<List<Map<String, Object>>> getWayBillOrder(
			@RequestParam("wayBillUnit")Integer wayBillUnit,
			@RequestParam("wayBillType")Integer wayBillType,
			@RequestParam("wayBillCode")String wayBillCode,
			@RequestParam("wayBillState")Integer wayBillState,
			@RequestParam("page")Integer page,
			@RequestParam("pageSize")Integer pageSize
			) {
		ResultBean<List<Map<String, Object>>> result = new ResultBean<List<Map<String, Object>>>();
		return BuildBean.buildResult(result, "成功", "失败", waybillService.getWayBillOrder(wayBillCode,wayBillState,page,pageSize,wayBillType,wayBillUnit));
	}
	
	
	
	
	@PostMapping("/indexData")
	public ResultBean<List<Map<String,Object>>> indexData(
			@RequestParam("waybillEntrustedunit")String waybillEntrustedunit
			){
		ResultBean<List<Map<String,Object>>> result = new ResultBean<List<Map<String,Object>>>();
		return BuildBean.buildResult(result, "success", "error", waybillService.indexData(waybillEntrustedunit));
	}
	
	

}
